package com.example.dailyrecord.base.entity;

import java.util.LinkedHashMap;
import java.util.Map;

public enum Options {

    AND(" and ","and"),
    OR(" or ","or"),

    EQ(" = ", "eq"),
    NEQ(" != ", "neq"),
    NL(" is null ", "nl"),
    NNL(" is not null ", "nnl"),
    GT(" > ", "gt"),
    GTE(" >= ", "gte"),
    LT(" < ", "lt"),
    LTE(" <= ", "lte"),
    BT(" between ", "bt"),
    NBT(" not between ", "nbt"),
    LK(" like ", "lk"),
    LLK(" like ", "llk"),
    RLK(" like ", "rlk"),
    NLK(" not like ", "nlk"),
    NLLK(" not like ", "nllk"),
    NRLK(" not like ", "nrlk"),
    IN(" in ", "in"),
    NIN(" not in ", "nin"),
    LClose(" ( ", "("),

    ;


    public static final Options[] COND_OPTION = {EQ, NEQ, NL, NNL,GT, GTE, LT, LTE, BT, NBT, LK, LLK, RLK, NLK, NLLK,
            NRLK, IN, NIN};
    public static final Map<String, Options> OPTIONS_MAP = new LinkedHashMap<>();

    static {
        for (Options options : COND_OPTION) {
            OPTIONS_MAP.put(options.getName(), options);
        }
    }

    private String opt;
    private String name;

    Options(String opt) {
        this.opt = opt;
    }

    Options(String opt, String name) {
        this.opt = opt;
        this.name = name;
    }

    public String getOpt() {
        return opt;
    }

    public String getName() {
        return name;
    }
}


